package com.hgsoft.pubsv.component.xxlconf.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;

import com.hgsoft.pubsv.component.xxlconf.properties.XxlConfProperties;
import com.xxl.conf.core.spring.XxlConfFactory;

import lombok.extern.slf4j.Slf4j;

/**
 * xxlconf bean 加载
 * @author saint
 *
 */
@Slf4j
public class XxlConfConfig {
	
	@Autowired
	private XxlConfProperties xxlConfProperties;

	@Bean
    public XxlConfFactory xxlConfFactory() {
    	XxlConfFactory xxlConf = new XxlConfFactory();
        xxlConf.setAdminAddress(xxlConfProperties.getAdminAddress());
        xxlConf.setEnv(xxlConfProperties.getEnv());
        xxlConf.setAccessToken(xxlConfProperties.getAccessToken());
        xxlConf.setMirrorfile(xxlConfProperties.getMirrorfile());
        log.info(">>>>>>>>>>> xxl-conf config init.");
        return xxlConf;
    }

}
